<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "c_intro".
 *
 * @property integer $id
 * @property string $showId
 * @property string $name
 * @property string $cate
 * @property string $pic
 * @property string $piece1
 * @property string $piece2
 * @property string $piece3
 * @property string $piece4
 * @property string $piece5
 * @property string $piece6
 * @property integer $status
 * @property integer $weight
 * @property string $created_at
 * @property string $updated_at
 * @property string $res1
 * @property string $res2
 * @property string $res3
 */
class Intro extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'c_intro';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name'], 'required'],
            [['status', 'weight', 'created_at', 'updated_at'], 'integer'],
            [['showId', 'cate'], 'string', 'max' => 40],
            [['name', 'pic', 'res1', 'res2', 'res3'], 'string', 'max' => 80],
            [['piece1', 'piece2', 'piece3', 'piece4', 'piece5', 'piece6'], 'string', 'max' => 150]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'showId' => 'Show ID',
            'name' => 'Name',
            'cate' => 'Cate',
            'pic' => 'Pic',
            'piece1' => '付费方式',
            'piece2' => 'Piece2',
            'piece3' => 'Piece3',
            'piece4' => 'Piece4',
            'piece5' => 'Piece5',
            'piece6' => 'Piece6',
            'status' => 'Status',
            'weight' => 'Weight',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'res1' => 'Res1',
            'res2' => 'Res2',
            'res3' => 'Res3',
        ];
    }
    public function getRelationImg()
    {
        return $this->hasOne(Img::className(), ['type_id' => 'showId']);
    }
}
